﻿using IISLogAnalyzer.Data.Providers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using IISLogAnalyzer.Model.Entities;
using System.Collections.Generic;

namespace ProviderUnitTests
{
    
    
    /// <summary>
    ///This is a test class for DataProviderTest and is intended
    ///to contain all DataProviderTest Unit Tests
    ///</summary>
    [TestClass()]
    public class DataProviderTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual DataProvider CreateDataProvider()
        {
            DataProvider target = DataProviderManager.Providers["FileLogProvider"];
            return target;
        }

        /// <summary>
        ///A test for DeleteLogData
        ///</summary>
        [TestMethod()]
        public void DeleteLogDataTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            W3CLogging logEvent = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.DeleteLogData(logEvent);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetAllLogData
        ///</summary>
        [TestMethod()]
        public void GetAllLogData_NotNull()
        {
            DataProvider target = CreateDataProvider();           
            List<W3CLogging> actual = target.GetAllLogData();
            Assert.IsNotNull(actual);            
        }

        /// <summary>
        ///A test for GetDataByCip
        ///</summary>
        [TestMethod()]
        public void GetDataByCipTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            List<AnalyzeResult> expected = null; // TODO: Initialize to an appropriate value
            List<AnalyzeResult> actual;
            actual = target.GetDataByCip();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetDataByResource
        ///</summary>
        [TestMethod()]
        public void GetDataByResourceTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            List<AnalyzeResult> expected = null; // TODO: Initialize to an appropriate value
            List<AnalyzeResult> actual;
            actual = target.GetDataByResource();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetDataByUa
        ///</summary>
        [TestMethod()]
        public void GetDataByUaTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            List<AnalyzeResult> expected = null; // TODO: Initialize to an appropriate value
            List<AnalyzeResult> actual;
            actual = target.GetDataByUa();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetDataPeriod
        ///</summary>
        [TestMethod()]
        public void GetDataPeriodTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            DateTime startDate = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime startDateExpected = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime endDate = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime endDateExpected = new DateTime(); // TODO: Initialize to an appropriate value
            target.GetDataPeriod(ref startDate, ref endDate);
            Assert.AreEqual(startDateExpected, startDate);
            Assert.AreEqual(endDateExpected, endDate);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for GetLogFromPeriod
        ///</summary>
        [TestMethod()]
        public void GetLogFromPeriodTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            DateTime startDate = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime endDate = new DateTime(); // TODO: Initialize to an appropriate value
            List<W3CLogging> expected = null; // TODO: Initialize to an appropriate value
            List<W3CLogging> actual;
            actual = target.GetLogFromPeriod(startDate, endDate);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for InsertLogData
        ///</summary>
        [TestMethod()]
        public void InsertLogDataTest()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            W3CLogging logEvent = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.InsertLogData(logEvent);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for InsertLogData
        ///</summary>
        [TestMethod()]
        public void InsertLogDataTest1()
        {
            DataProvider target = CreateDataProvider(); // TODO: Initialize to an appropriate value
            List<W3CLogging> logList = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.InsertLogData(logList);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
